﻿using OMG.Fill.Potato.Model.Ent;
using OMG.Fill.Potato.Service;
using OMG.Fill.Potato.Services;
using ProjectShare;
using System.Collections.Generic;
using System.Web.Http;
namespace OMG.Fill.Potato.Model.UI.Controllers
{
    public class DictController : ApiController
    {
        DictServices dictServices = new DictServices();
        
        //[ApiActionAuthorize("获取数据字典表T_Dict分页列表对象操作")]
        //[ApiActionException]
        public Pager<List<DictEntity>> PostPageList(DictQuery query)
        {
            return dictServices.GetPageList(query);
        }
        //[ApiActionAuthorize("新增数据字典表T_Dict指定对象操作")]
        //[ApiActionException]
        public ResResult<int> Post(DictEntity model) {
            return dictServices.AddInfo(model);
        }
        //[ApiActionAuthorize("修改数据字典表T_Dict指定对象操作")]
        //[ApiActionException]
        public ResResult<int> Put(DictEntity model)
        {
            return dictServices.UpdateInfo(model);
        }
        //[ApiActionAuthorize("删除数据字典表T_Dict指定对象操作")]
        //[ApiActionException]
        public ResResult<int> Delete(string id)
        {
            return dictServices.DeleteInfo(id);
        }
        //[ApiActionAuthorize("获取数据字典表T_Dict指定对象操作")]
        //[ApiActionException]
        public ResResult<DictEntity> Get(string id)
        {
            return dictServices.GetModel(id);
        }
        public ResResult<List<DictEntity>> GetList()
        {
            return dictServices.GetList();
        }
        public ResResult<List<GroupItem>> GetGroupList()
        {
            return dictServices.GetGroupList();
        }
        public ResResult<List<DictEntity>> GetDicByGroupCode(string GroupCode)
        {
            ResResult<List<DictEntity>> obj = new ResResult<List<DictEntity>>();
            obj.model = dictServices.GetDicByGroupCode(GroupCode);
            obj.status = DefaultKey.SuccessResult;
            obj.message = "";
            return obj;
        }

    }
}